<m-api-data-table [dataSource]="dataSource" [selection]="selection" [searchControl]="searchControl" #tableRef>
    <ng-container mDataTableColumn header="角色">
        <ng-template let-type="utype">
            <td>
                <m-user-type-text [type]="type"></m-user-type-text>
            </td>
        </ng-template>
    </ng-container>
    <ng-container mDataTableColumn header="姓名">
        <ng-template let-name="full_name">
            <td>{{ name }}</td>
        </ng-template>
    </ng-container>
    <ng-container mDataTableColumn header="状态">
        <ng-template let-status="status">
            <td>
                <m-enable-status-text [status]="status"></m-enable-status-text>
            </td>
        </ng-template>
    </ng-container>
    <ng-container mDataTableColumn header="工号">
        <ng-template let-job="job_number">
            <td>{{ job }}</td>
        </ng-template>
    </ng-container>
    <ng-container mDataTableColumn header="在线">
        <ng-template let-status="online">
            <td>
                <m-online-status-text [status]="status"></m-online-status-text>
            </td>
        </ng-template>
    </ng-container>
    <ng-container mDataTableColumn header="操作">
        <ng-template let-id="user_id" let-name="name" let-status="status">
            <td>
                <button mat-icon-button [matMenuTriggerFor]="editMenuRef">
          <mat-icon>edit</mat-icon>
        </button>
                <mat-menu #editMenuRef>
                    <button mat-menu-item (click)="permission(id)">定制权限</button>
                    <button mat-menu-item [mDetailRouterLink]="{ id: id, type: 'personnel', name: name }">
            查看人员信息
          </button>
                    <button mat-menu-item (click)="tableRef.refresh(disable(id))" *ngIf="status === EnableStatus.Enable">
            冻结
          </button>
                    <button mat-menu-item (click)="tableRef.refresh(enable(id))" *ngIf="status === EnableStatus.DisableInZone">
            激活
          </button>

                    <!-- <button mat-menu-item [style.color]="'red'" (click)="tableRef.refresh(delete(id))">
            移除人员
          </button> -->
                </mat-menu>
            </td>
        </ng-template>
    </ng-container>
    <button class="btn btn-secondary btn-sm mr-3" (click)="tableRef.selectAll()">全选</button>
    <button class="btn btn-secondary btn-sm" [matMenuTriggerFor]="editMenuRef">
    批量操作
  </button>
    <mat-menu #editMenuRef>
        <button mat-menu-item (click)="permission()">定制权限</button>
        <button mat-menu-item (click)="tableRef.refresh(disable())">冻结</button>
        <button mat-menu-item (click)="tableRef.refresh(enable())">激活</button>
        <!-- <button mat-menu-item [style.color]="'red'" (click)="tableRef.refresh(delete())">
      移除人员
    </button> -->
    </mat-menu>
</m-api-data-table>